<template>
	<view class="content">
		<view class="main">
			<!-- <view class="title">
				<text>我的招聘</text>
			</view> -->
			<view class="nav" >
				<view class="navList">
					<text :class='navListIndex === index? "active":" "'
						v-for="(item,index) in navList" :key="index" @tap="changeTab(index)">
						{{item.name}}
					</text>
				</view>
			</view>
      <List :glist="getCurPageList" :status="status"></List>
      <loadmore :moreObj="more" @load="onLoadmore"></loadmore></view>
		<Tabbar :current="3"></Tabbar>
	</view>
</template>

<script>

import List from "./components/List.vue"
import{myComDeliveryList} from '@/api/myCompan'
export default {
	components: {
		List,
	},
	data() {
		return {
			navListIndex:0,
      status:1,
			navList:[
				{name:'已投递'},
				{name:'待面试'},
				{name:'已面试'}
			]
		}
	},
  onLoad(opt) {
    if(+opt.deliveryIndex){
      this.navListIndex = +opt.deliveryIndex
    }
    if(this.navListIndex===0){
      this.myComDeliveryList( this.status)
    }
  },
  onShow(){

  },
	methods: {
    //我的活动分页列表查询
    async myComDeliveryList(status){
      await  this.getCurrentPageList(myComDeliveryList,{pageNo: this.pageNo,pageSize: this.pageSize,status},'2')
    },
    //加载更多
    onLoadmore(){
      this.pageNo++
      this.myComDeliveryList( this.status)
    },
		//点击切换
		changeTab(index){
      this.onReset()
			if(this.navListIndex === index){
				return;
			}
			this.navListIndex = index;
      this.status = index===0?1:index===1?2:3
      this.myComDeliveryList( this.status)

		},
		nextPage(url) {
			uni.navigateTo({
				url: url,
				fail() {
					uni.switchTab({
						url: url,
						fail() {
							uni.showToast({
								title: '暂未开通，敬请期待！',
								icon: 'none'
							});
						}
					});
				}
			});
		}
	}
}
</script>

<style lang="scss" scoped>
.content{
	.main{
		background: #F0F3F5;
		height: 100vh;
		.title{
			position: relative;
			width: 100%;
			height: 120rpx;
			line-height: 120rpx;
			text-align: center;
			background: linear-gradient(90deg, #52B8B2 0%, #5EC8A3 100%);
			text{
				font-size: 32rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #FFFFFF;
			}
		}
		.header{
			padding-bottom: 10rpx;
			background: linear-gradient(90deg, #52B8B2 0%, #5EC8A3 100%);
			.title{
				position: relative;
				width: 100%;
				height: 120rpx;
				line-height: 120rpx;
				text-align: center;
				.u-icon{
					position: absolute;
					height: 120rpx;
					left: 20rpx;
				}
				text{
					font-size: 32rpx;
					font-family: PingFang SC;
					font-weight: bold;
					color: #FFFFFF;
				}
			}
		}
		.nav{
			padding: 30rpx 0;
			display: flex;
			justify-content: center;
			.navList{
				padding: 0 14rpx;
				width: auto;
				height: 80rpx;
				line-height: 80rpx;
				background: #FFFFFF;
				border-radius: 18rpx;
				text-align: center;
				.active{
					padding: 10rpx 30rpx;
					background: #53BAB1;
					border-radius: 10rpx;
					color: #FFFFFF;
				}
				text{
					padding: 10rpx 30rpx;
					border-radius: 10rpx;
					color: #323233;
					font-size: 32rpx;
					font-family: PingFang SC;
					font-weight: bold;
				}
			}
		}
	}
}
</style>
